package com.bamboo.tool.enums;

import lombok.Getter;

@Getter
public enum AttributeEnums {

    POOL_URL("poolUrl", "项目url"),
    CLASS_URL("classUrl", "类url"),
    METHOD_URL("methodUrl", "方法url"),
    REQUEST_METHOD("requestMethod", "请求类型"),
    DESCRIPTION("desc", "描述"),

    CONSUMES("consumes", "指定处理请求的提交内容类型（Content-Type），例如application/json, text/html;"),
    PRODUCES("produces", "指定返回的内容类型，仅当request请求头中的(Accept)类型中包含该指定类型才返回"),
    HEADERS("headers", "指定request中必须包含某些指定的header值，才能让该方法处理请求"),
    CONTENT_TYPE("content-type", "内容类型"),
    REQUIRED("required", "是否必须"),
    FIELDMIN("fieldMin", "最小长度"),
    FIELDMAX("fieldMax", "最大长度"),
    FIELD_NAME("fieldName", "字段名称"),
    IS_PATH_PARAM("is_path_param", "是否为url参数"),
    IS_QUERY_PARAM("is_query_param", "是否为表单参数"),
    IS_BODY_PARAM("is_body_param", "是否为body参数"),
    IS_HEAD_PARAM("is_head_param", "是否为请求头参数"),

    DEFAULT_VALUE("defaultValue", "默认值"),
    DEPRECATED("deprecated", "废弃"),
    IGNORE("ignore", "忽略"),
    METHOD_SCAN("methodScan", "方法扫描方式"),
    CLASS_URL_PREFIX("classUrlPrefix", "class url 前缀"),

    METHOD_NAME_URL("methodNameUrl", "方法名为url"),
    ;

    private final String code;
    private final String desc;

    AttributeEnums(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AttributeEnums getAttributeEnums(String code) {
        for (AttributeEnums value : AttributeEnums.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
